//
//  UserBaseInfoView.m
//  YIJU2.0-HD
//
//  Created by URANUS on 16/5/16.
//  Copyright © 2016年 张金国. All rights reserved.
//

#import "UserBaseInfoView.h"
#import "TitleLabelAndTextFieldView.h"
#import "Macro.h"
#import "Masonry.h"



@interface UserBaseInfoView ()<UITextFieldDelegate>
@property (nonatomic, strong)NSArray *titleArray;//title数组

@end

@implementation UserBaseInfoView

- (instancetype)init {
    if (self == [super init]) {
        [self titleArray];
        [self setUpContaints];
    }
    return self;
}

#pragma mark - UITextFieldDelegate
- (void)textFieldDidBeginEditing:(UITextField *)textField {
    textField.layer.borderWidth = kTextFieldBorderWith;
}

- (void)textFieldDidEndEditing:(UITextField *)textField {
    textField.layer.borderWidth = 0;
}

- (void)setUpContaints {
    UIView *tempView = nil;
    for (int i = 0; i < 15; i ++) {
        TitleLabelAndTextFieldView *TextLabelView = [[TitleLabelAndTextFieldView alloc] initWithBlockMyEditText:^(UITextField *MyText) {
            MyText.delegate = self;
        }];
        TextLabelView.TitleString = _titleArray[i];
        TextLabelView.backgroundColor = [UIColor clearColor];
        [self addSubview:TextLabelView];
        
        if (tempView == nil) {
            [TextLabelView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(self.mas_top).offset(70);
                make.left.equalTo(self.mas_left);
                make.width.equalTo(self.mas_width);
                make.height.equalTo(@(SCREEN_HEIGHT * 0.05));
            }];
        } else {
            [TextLabelView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(tempView.mas_bottom);
                make.left.equalTo(self.mas_left);
                make.width.equalTo(self.mas_width);
                make.height.equalTo(@(SCREEN_HEIGHT * 0.05));
            }];
        }
        tempView = TextLabelView;
    }
}

- (NSArray *)titleArray {
    if (_titleArray == nil) {
        _titleArray = @[@"姓     名:",@"性     别:",@"电     话:",@"职     业:",@"年     龄:",@"年收入:",@"家庭人口:",@"婚姻状况:",@"住房情况:",@"购车情况:",@"QQ:      ",@"邮       箱:",@"家庭电话:",@"现居地址:",@"工作地址:"];
    }
    return _titleArray;
}


@end
